import React, {Component} from 'react';

class App extends Component {
    state = {
        value: ''
    }

    render() {
        return (<div>
            <input type='text' placeholder='请输入用户名'
                   value={this.state.value}
                   onChange={event =>
                       this.setState({value: event.target.value})
                   }
            />
            <button onClick={() => console.log(this.state.value)}>登录</button>
            <button onClick={() => this.setState({value: ''})}>重置</button>
        </div>);
    }
}

export default App;